<template>
	<view class="bigView">
		<!-- <view style="width: 100%;display: flex;justify-content: center;color:black;font-weight: bold">需要开放端口</view> -->
		<view style="background-color: white;margin-top: 8px;">
			<!-- <view class="itemInput">
				<view class="leftLabel">姓名</view>
				<u--input class="customInput" placeholder="请填写姓名" border="surround" v-model="userInfo.realName"	
				inputAlign="right" />
			</view> -->
			<!-- <view class="itemInput">
				<view class="leftLabel">花名</view>
				<u--input class="customInput" placeholder="请填写花名" border="surround" v-model="userInfo.name"	
				inputAlign="right" />
			</view> -->
			<!-- <view class="itemInput">
				<view class="leftLabel">工号</view>
				<u--input class="customInput" placeholder="请填写工号" border="surround" v-model="userInfo.employeeId"	
				inputAlign="right" />
			</view>
			<view class="itemInput">
				<view class="leftLabel">部门</view>
				<u--input class="customInput" placeholder="请填写部门" border="surround" v-model="userInfo.department"	
				inputAlign="right" />
			</view>
			<view class="itemInput">
				<view class="leftLabel">岗位</view>
				<u--input class="customInput" placeholder="请填写岗位" border="surround" v-model="userInfo.post"	
				inputAlign="right" />
			</view>
			<view class="itemInput">
				<view class="leftLabel">学历</view>
				<u--input class="customInput" placeholder="请填写学历" border="surround" v-model="userInfo.education"	
				inputAlign="right" />
			</view> -->
			
			<u-cell size="large" title="姓名" :value="userInfo.realName"></u-cell>
			<u-cell size="large" title="工号" :value="userInfo.employeeId"></u-cell>
			<u-cell size="large" title="部门" :value="userInfo.department"></u-cell>
			<u-cell size="large" title="岗位" :value="userInfo.post"></u-cell>
			<u-cell size="large" title="年龄" :value="userInfo.age"></u-cell>
			<u-cell size="large" title="联系方式" :value="userInfo.phone"></u-cell>
			<u-cell size="large" title="司龄" :value="userInfo.companyYears"></u-cell>
			<u-cell size="large" title="计薪方式" :value="userInfo.salTypeDesc"></u-cell>
			<u-cell size="large" title="入职时间" :value="userInfo.entryTime"></u-cell>
			<u-cell size="large" title="在职状态" :value="userInfo.dutyStatusView"></u-cell>
		</view>
		<!-- <view class="bottomView" :style="[{height:bottom + 'px'}]">
			<view class="sure" @click="sureHandle">修改</view>
		</view> -->
	</view>
</template>

<script>
	import mine from '@/api/mine.js'
	export default{
		data(){
			return {
				bottom:0,
				indexList:[1,2],
				dataList:[],
				userInfo:{},
			}
		},
		mounted() {
			uni.getSystemInfo({success: (e) => {
				let custom = wx.getMenuButtonBoundingClientRect();
				this.bottom = custom.bottom;
			}})
			this.$nextTick(() =>{
				this.initUserInfo()
			})
		},
		methods:{
			initUserInfo(){
				const userInfo = uni.getStorageSync("userInfo")
				if(userInfo){
					this.userInfo = JSON.parse(userInfo)
				}
				this.getUserHandle();
			},
			usersPutHandle(){
				uni.showLoading({
					title:'正在修改...'
				})
				mine.usersPutHandle(this.userInfo).then(res =>{
					uni.hideLoading()
					uni.showToast({
						title:'修改成功'
					})
					this.getUserHandle();
				}).catch(err =>{
					uni.hideLoading()
				})
			},
			getUserHandle(){
				mine.getUserHandle({id:this.userInfo.id}).then(res =>{
					this.userInfo = res;
					uni.setStorageSync("userInfo",JSON.stringify(res))
				}).catch(err =>{
					
				})
			},
			sureHandle(){
				this.usersPutHandle()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bigView{
		width: 100vw;
		height: 100vh;
		background-color: #F7F7F7;
		display: flex;
		flex-direction: column;
		// align-items: center;
		// justify-content: center;
	}
	.itemInput{
		display: flex;
		flex-direction: row;
		height: 51px;
		background-color: white;
		align-items: center;
		width: 100vw;//calc(100vw - 32px);
		border-bottom: rgba(0,0,0,0.08) 1px solid;
	}
	.leftLabel{
		padding-left: 16px;
	}
	
	.bottomView{
		height: 150px;
		width: 100vw;
		// background-color: yellow;
		display: flex;
		justify-content: center;
		margin-top: 10px;
		.sure{
			width: calc(100vw - 104px);//calc(100vw-#{32px});
			height: 48px;
			border-radius: 24px;
			background-color: #247BFD;
			display: flex;
			align-items: center;
			justify-content: center;
			color: white;
		}
	}
</style>